package exception;

import java.io.FileOutputStream;
import java.io.FileWriter;
import java.io.IOException;

//1.7后新特性:自动关闭特性
public class AutoCloseableDemo {
    public static void main(String[] args) {
        System.out.println("程序开始");
        try (
                FileWriter fw = new FileWriter("d/f/a.txt")
        ) {
            fw.write("以父之名");
        } catch (IOException e) {
            System.out.println("出现并解决ioe异常");
        }
        System.out.println("程序结束");
    }
}
